﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using POSSystem.BLL;

namespace MobileShop.Controls
{
    public partial class BaseControl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public static SystemVariables SysVars
        {
            get { return SystemVariables.SysVars; }
        }

        public string GetDefaultPic()
        {
            return this.Page.ResolveUrl("~/images/empty.png");
        }

        public void ShowErrorMessage(Control parent, String msg)
        {
            String div = "<div class='{0}'>{1}</div>";
            Literal lit = new Literal();
            lit.Text = String.Format(div, "labelError", msg);

            parent.Controls.Add(lit);
        }

        public void ShowHintMessage(Control parent, String msg)
        {
            String div = "<div class='{0}'>{1}</div>";
            Literal lit = new Literal();
            lit.Text = String.Format(div, "labelHint", msg);

            parent.Controls.Add(lit);
        }

        public const string SESSION_USER = "SESSION_CUSTOMER";
        public View_Customers SessionUser
        {
            get { return (View_Customers)Session[SESSION_USER]; }
            set { Session.Remove(SESSION_USER); Session[SESSION_USER] = value; }
        }
    }
}